/* 
 *Update By: Steven Jiang
 *Update Time: 2008-12-23 11:21
 *Description:
 *  Add ParentDomainID and ParentDomain Fields, but ParentDomain field is a object Type. 
 */
namespace Jumpton.SFA.Server.Entity {
    using System;
    using System.Collections.Generic;
    using System.Text;
    using Jumpton.Persistent;
    using System.Data;
    using System.Runtime.Serialization;
    
    
    [System.SerializableAttribute()]
    [Map("DOMAINS")]
    public class DOMAINS : ObjectRow {
        
        public DOMAINS() {
        }
        
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataRow">DataTable 中的一行数据</param>
        /// <param name="objectTable">存储当前对象的数据表格</param>
        public DOMAINS(System.Data.DataRow dataRow, ObjectTable parent) : 
                base(dataRow, parent) {
        }
        
        /// <summary>
        /// 供反序列化使用的构造函数
        /// </summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        protected DOMAINS(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : 
                base(info, context) {
        }
        
        [Key("ID",true,true)]
        public decimal ID {
            get {
                return (System.Decimal)GetValue("ID");
            }
            set {
                SetValue("ID", value);
            }
        }
        
        [Field("CODE")]
        public string CODE {
            get {
                return (System.String)GetValue("CODE");
            }
            set {
                SetValue("CODE", value);
            }
        }

        [Field("LAST_UPDATER")]
        public string LAST_UPDATER
        {
            get {
                return (System.String)GetValue("LAST_UPDATER");
            }
            set {
                SetValue("LAST_UPDATER", value);
            }
        }
        
        [Field("LAST_UPDATE_TIME")]
        public long LAST_UPDATE_TIME {
            get {
                return (long)GetValue("LAST_UPDATE_TIME", DateTime.Now);
            }
            set {
                SetValue("LAST_UPDATE_TIME", value);
            }
        }

        [Field("CREATE_TIME")]
        public long CREATETIME
        {
            get
            {
                return (long)GetValue("CREATETIME", DateTime.Now);
            }
            set
            {
                SetValue("CREATETIME", value);
            }
        }

        [Field("ACTIVE")]
        public Boolean ACTIVE
        {
            get
            {
                return (System.Boolean)GetValue("ACTIVE", false);
            }
            set
            {
                SetValue("ACTIVE", value);
            }
        }
        
        [Field("SYS_NAME")]
        public string SYSNAME {
            get {
                return (System.String)GetValue("SYSNAME");
            }
            set {
                SetValue("SYSNAME", value);
            }
        }
        
        [Field("SYS_ID_NO")]
        public string SYSIDNO {
            get {
                return (System.String)GetValue("SYSIDNO");
            }
            set {
                SetValue("SYSIDNO", value);
            }
        }

   
        [Field("SYSTEM_ADDITIONAL_INFO2")]
        public string SYSTEMADDITIONALINFO2 {
            get {
                return (System.String)GetValue("SYSTEMADDITIONALINFO2");
            }
            set {
                SetValue("SYSTEMADDITIONALINFO2", value);
            }
        }
        
        [Field("SYSTEM_ADDITIONAL_INFO3")]
        public string SYSTEMADDITIONALINFO3 {
            get {
                return (System.String)GetValue("SYSTEMADDITIONALINFO3");
            }
            set {
                SetValue("SYSTEMADDITIONALINFO3", value);
            }
        }
        
        [Field("SYSTEM_ADDITIONAL_INFO4")]
        public string SYSTEMADDITIONALINFO4 {
            get {
                return (System.String)GetValue("SYSTEMADDITIONALINFO4");
            }
            set {
                SetValue("SYSTEMADDITIONALINFO4", value);
            }
        }
        
        [Field("SYSTEM_ADDITIONAL_INFO5")]
        public string SYSTEMADDITIONALINFO5 {
            get {
                return (System.String)GetValue("SYSTEMADDITIONALINFO5");
            }
            set {
                SetValue("SYSTEMADDITIONALINFO5", value);
            }
        }

        [Field("SYSTEM_ADDITIONAL_INFO1")]
        public string SYSTEMADDITIONALINFO1
        {
            get
            {
                return (System.String)GetValue("SYSTEMADDITIONALINFO1");
            }
            set
            {
                SetValue("SYSTEMADDITIONALINFO1", value);
            }
        }

        /// <summary>
        /// 父域ID
        /// </summary>
        [Field("ParentDomainID")]
        public Decimal ParentDomainID
        {
            get
            {
                return (Decimal)GetValue("ParentDomainID", -1);
            }
            set
            {
                SetValue("ParentDomainID", value);
            }
        }


        /// <summary>
        ///获取父域对象，如果不存在则为空
        /// </summary>
        [CalculateField]
        public DOMAINS ParentDomain
        {
            get
            {
                if (ParentDomainID != -1)
                    return (DOMAINS)ObjectRow.Load(typeof(DOMAINS), "this.ID=" + ParentDomainID);
                return null;
            }
           
        }
    }
}
